home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.macos;
-
- import java.awt.Choice;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.FontMetrics;
- import java.awt.peer.ChoicePeer;
-
- class MChoicePeer extends MComponentPeer implements ChoicePeer, ActionComponent {
- int mActualMenuContents;
-
- public MChoicePeer(Choice var1) {
- super(var1);
- }
-
- native void create(MComponentPeer var1);
-
- public native void select(int var1);
-
- void initialize() {
- Choice var1 = (Choice)super.target;
- int var2 = var1.countItems();
-
- for(int var3 = 0; var3 < var2; ++var3) {
- this.addItem(var1.getItem(var3), var3);
- }
-
- this.select(var1.getSelectedIndex());
- super.initialize();
- }
-
- public Dimension minimumSize() {
- FontMetrics var1 = ((MComponentPeer)this).getFontMetrics(super.target.getFont());
- Choice var2 = (Choice)super.target;
- int var3 = 0;
-
- for(int var4 = var2.countItems(); var4-- > 0; var3 = Math.max(var1.stringWidth(var2.getItem(var4)), var3)) {
- }
-
- return new Dimension(40 + var3, var1.getHeight() + 4);
- }
-
- public native void addItem(String var1, int var2);
-
- public native void remove(int var1);
-
- public void action(int var1) {
- Choice var2 = (Choice)super.target;
- var2.select(var1);
- super.target.postEvent(new Event(super.target, 1001, var2.getItem(var1)));
- }
-
- public void action() {
- System.err.println("Internal AWT error");
- }
-
- public void action(boolean var1) {
- System.err.println("Internal AWT error");
- }
-
- public void handleAction(int var1) {
- InterfaceThread.postInterfaceEvent(super.target, var1);
- }
- }
-